package com.shanzmoo.core.domain.dto;

import cn.hutool.core.bean.BeanUtil;
import com.shanzmoo.base.bean.ValidList;
import com.shanzmoo.db.store.entity.StoreDeliveryBillEntity;

import java.io.Serializable;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * 仓库发货单 保存对象
 *
 * @author Gzhao 2021-03-11
 */
@Data
@ApiModel("仓库发货单-保存对象")
public class StoreDeliveryBillSaveDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    @NotNull(message = "发货类型不允许为空")
    @ApiModelProperty(value = "发货类型：0-物流，1-自提")
    private Integer sendType;

    @ApiModelProperty(value = "物流单号")
    private String logisticsNo;

    @ApiModelProperty(value = "物流公司")
    private String logisticsCompany;

    @NotNull(message = "用户ID不允许为空")
    @ApiModelProperty(value = "用户ID")
    private Integer memberId;

    @ApiModelProperty(value = "收件人")
    private String consignee;

    @ApiModelProperty(value = "收件人手机")
    private String consigneeMobile;

    @ApiModelProperty(value = "收件人所在省市区")
    private String consigneeDistrict;

    @ApiModelProperty(value = "收件人详细地址")
    private String consigneeAddress;

    @ApiModelProperty(value = "备注")
    private String remark;

    @NotEmpty(message = "发货类型不允许为空")
    @ApiModelProperty(value = "发货商品明细")
    ValidList<StoreDeliveryBillDetailSaveDTO> detailList;

    public StoreDeliveryBillEntity convertEntity() {
        StoreDeliveryBillEntity target = new StoreDeliveryBillEntity();
        BeanUtil.copyProperties(this, target, true);
        return target;
    }
}
